//
//  CellSectionOneForVCOfCellForExploreSectionOne.m
//  echo
//
//  Created by dllo on 16/3/15.
//  Copyright © 2016年 Danny. All rights reserved.
//

#import "CellSectionOneForVCOfCellForExploreSectionOne.h"
#import "ModelForRecommendTableViewCell.h"
#import <SDWebImage/UIButton+WebCache.h>

@implementation CellSectionOneForVCOfCellForExploreSectionOne

- (void)passModelForButtons:(NSArray *)arr {
    self.arrForData = [NSMutableArray arrayWithArray:arr];
    ModelForRecommendTableViewCell *model1 = [arr objectAtIndex:0];
    ModelForRecommendTableViewCell *model2 = [arr objectAtIndex:1];
    
    [self.buttonForLeft sd_setBackgroundImageWithURL:[NSURL URLWithString:model1.pic] forState:UIControlStateNormal];
    [self.buttonForRight sd_setBackgroundImageWithURL:[NSURL URLWithString:model2.pic] forState:UIControlStateNormal];
    
    [self.buttonForLeft addTarget:self action:@selector(handleButtonForLeftOfExploreSectionOne:) forControlEvents:UIControlEventTouchUpInside];
    [self.buttonForRight addTarget:self action:@selector(handleButtonForRightOfExploreSectionOne:) forControlEvents:UIControlEventTouchUpInside];
    
    self.labelForLeft.text = model1.name;
    self.labelForRight.text = model2.name;
    
    self.labelForLeftBottom.text = model1.channel;
    self.labelForRightBottom.text = model2.channel;
    
}

- (void)handleButtonForLeftOfExploreSectionOne:(UIButton *)button{
    ModelForRecommendTableViewCell *model = [self.arrForData objectAtIndex:0];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"postModelForLeftOfExploreSectionOne" object:nil userInfo:@{@"model":model}];
}

- (void)handleButtonForRightOfExploreSectionOne:(UIButton *)button{
    ModelForRecommendTableViewCell *model = [self.arrForData objectAtIndex:1];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"postModelForRightOfExploreSectionOne" object:nil userInfo:@{@"model":model}];
}




/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
